class_name 翻江倒海
extends Node2D

@onready var life_timer: Timer = $LifeTimer
@onready var hitbox_component: HitboxComponent = $HitboxComponent

var direction: Vector2
var source_peer_id: int
var damage: int = 4



func _ready() -> void:
	hitbox_component.damage = damage

	hitbox_component.source_peer_id = source_peer_id

	hitbox_component.hit_hurtbox.connect(_on_hit_hurtbox)
	life_timer.timeout.connect(_on_life_timer_timeout.bind())


func start(direction_context: Vector2):
	self.direction = direction_context
	#rotation = direction.angle()	
	if direction_context.x < 0 :
		scale.x = -1
		
		




func register_collision():
	#设置了这个，伤害只会触发一次
	hitbox_component.is_hit_handled = false
	

func  _on_life_timer_timeout():
	pass

func _on_hit_hurtbox(_hurtbox_component: HurtboxComponent):
	register_collision()
